package edu.hunau.cxb19.oop.class19.pojo;

/**
 *
 * @author hb
 *
 *         2020-03-20 14:49:19
 */
public class Apple {
	/**
	 * 颜色
	 */
	private String color;
	/**
	 * 重量
	 */
	private int weight;
	/**
	 * 产地
	 */
	private String origin;

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj == this) {
			return true;
		}
		if (obj instanceof Apple) {
			Apple other = (Apple) obj;
			return this.color.equals(other.color) && this.origin.equals(other.origin) && this.weight == other.weight;
		}
		return super.equals(obj);
	}

	@Override
	public int hashCode() {
		return color.hashCode() >>> origin.hashCode() >>> weight;
	}

	/**
	 * @param color
	 * @param weight
	 */
	public Apple(String color, int weight) {
		super();
		this.color = color;
		this.weight = weight;
	}

	/**
	 * @param color
	 * @param weight
	 * @param origin
	 */
	public Apple(String color, int weight, String origin) {
		super();
		this.color = color;
		this.weight = weight;
		this.origin = origin;
	}

	/**
	 * 
	 */
	public Apple() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @return the color
	 */
	public String getColor() {
		return color;
	}

	@Override
	public String toString() {
		return "Apple [color=" + color + ", weight=" + weight + ", origin=" + origin + "]";
	}

	/**
	 * @param color the color to set
	 */
	public void setColor(String color) {
		this.color = color;
	}

	/**
	 * @return the weight
	 */
	public int getWeight() {
		return weight;
	}

	/**
	 * @param weight the weight to set
	 */
	public void setWeight(int weight) {
		this.weight = weight;
	}

	/**
	 * @return the origin
	 */
	public String getOrigin() {
		return origin;
	}

	/**
	 * @param origin the origin to set
	 */
	public void setOrigin(String origin) {
		this.origin = origin;
	}

}
